#include "result.h"
#include <iostream>

std::ostream& operator<<(std::ostream& s,const match_result& m)
{
	s<<'(';
	s<<m.matched ? "Matched":"Match Failed";
	s<<','<<m.length<<')';
	return s;
}

ref_pair match_result::get(size_t s)
{
    if(s<backref.size())
    {
        return ref_pair(backref.at(s).length(),backref.at(s));
    }
    else
    {
        return ref_pair(0,"");
    }
}

std::ostream& operator<<(std::ostream& s,const ref_pair& p)
{
	s<<'(';
	s<<p.size;
	s<<",\""<<p.what<<"\")";
	return s;
}
